package com.bage.finance.biz.service.impl;

import com.bage.common.service.TokenService;
import com.bage.finance.biz.config.ObjectConvertor;
import com.bage.finance.biz.domain.AssistCalculateCashFlow;
import com.bage.finance.biz.dto.AdminDTO;
import com.bage.finance.biz.dto.vo.ListAssistCalculateCashFlowVo;
import com.bage.finance.biz.enums.AssistCalculateCateCodeEnum;
import com.bage.finance.biz.mapper.AssistCalculateCashFlowMapper;
import com.bage.finance.biz.service.AssistCalculateHandleService;
import com.bage.mybatis.help.MyBatisWrapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

import static com.bage.finance.biz.domain.AssistCalculateCashFlowField.*;
import static com.bage.finance.biz.domain.AssistCalculateCashFlowField.AssistCalculateSummaryId;

@Slf4j
@Service
@RequiredArgsConstructor
public class AssistCalculateCashFlowServiceImpl implements AssistCalculateHandleService {

    final ObjectConvertor objectConvertor;

    final TokenService<AdminDTO> tokenService;

    final AssistCalculateCashFlowMapper assistCalculateCashFlowMapper;

    @Override
    public AssistCalculateCateCodeEnum getAssistCalculateCateCodeEnum() {
        return AssistCalculateCateCodeEnum.CASH_FLOW;
    }

    @Override
    public boolean create(Object object) {
        return false;
    }

    @Override
    public List<ListAssistCalculateCashFlowVo> listByAssistCalculateSummaryIds(List<Long> assistCalculateSummaryIds) {
        MyBatisWrapper<AssistCalculateCashFlow> wrapper = new MyBatisWrapper<>();
        wrapper.select(Id, CashFlowCate, Disable, AssistCalculateSummaryId)
                .whereBuilder()
                .andEq(TenantId, tokenService.getThreadLocalTenantId())
                .andEq(DelFlag, false)
                .andIn(AssistCalculateSummaryId, assistCalculateSummaryIds);
        List<AssistCalculateCashFlow> assistCalculateCashFlows = assistCalculateCashFlowMapper.list(wrapper);
        return objectConvertor.toListAssistCalculateCashFlowVo(assistCalculateCashFlows);
    }

    @Override
    public Object get(Long assistCalculateSummaryId) {
        return null;
    }

    @Override
    public boolean update(Object object) {
        return false;
    }
}
